package edu.sctu.practice.class01.zhoudie.assgin03;

/**
 * Created by Administrator on 2015-10-22.
 */

public class Main {
    public static void main(String[] args)
    {
        GeometricObject geoObject1 = new Circle(4,"蓝色");
        GeometricObject geoObject2 = new Rectangle(4, 3,"红色");

        System.out.println("这两个图形的面积是否相同？ " + equalArea(geoObject1, geoObject2));
        displayGeometricObject(geoObject1);
        displayGeometricObject(geoObject2);
    }
    static boolean equalArea(GeometricObject object1, GeometricObject object2) {
        return object1.findArea() == object2.findArea();
    }
    static void displayGeometricObject(GeometricObject object) {
        System.out.println();
        System.out.println(object.toString());
        System.out.println("面积为：" + object.findArea());
        System.out.println("周长为：" + object.findPerimeter());
    }
}



